﻿<local:GroupWindowBase x:Name="groupWindowBase"  x:Class="Rio.Framework.Pages.ChildWindows.ChoiceGroupWindow"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:gridViewElements="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
                    xmlns:local="clr-namespace:Rio.Framework.Pages.ChildWindows"
                    mc:Ignorable="d"
                    xmlns:Converter="clr-namespace:Rio.Framework.Pages.Helpers.Converter"
                    Header="Choix des destinataires"
                    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
                    xmlns:window="http://schemas.telerik.com/2008/xaml/presentation" 
                    Height="434" 
                    Width="669">

    <Grid Name="LayoutRoot" Margin="1,0">

        <Grid.Resources>
            <Converter:FieldToImageConverter x:Key="FieldToImageConverter" />
        </Grid.Resources>

        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.450*" />
            <ColumnDefinition Width="33"/>
            <ColumnDefinition Width="0.450*" />
            <ColumnDefinition Width="0.054*"/>
        </Grid.ColumnDefinitions>

        <TextBlock Name="UsersAvaillableTextBlock" Text="Groupes / Utilisateurs" Grid.Column="0" 
                   VerticalAlignment="Top" FontSize="11" MaxWidth="330" TextWrapping="Wrap" Margin="0,0,42,0" Visibility="Collapsed"/>
        <StackPanel Orientation="Horizontal" 
                    Grid.Column="0" 
                    Grid.Row="0" VerticalAlignment="Top" Height="31">
            <TextBlock Name="LabelStartingWith"
                       Text="Commençant par: " VerticalAlignment="Bottom" />
            <TextBox Name="TextBoxStartingWith"
                     Width="184"
                     Height="20"
                     TextChanged="FilterValue_TextChanged" VerticalAlignment="Bottom" />
        </StackPanel>
        <gridViewElements:RadGridView x:Name="GridUsersAvailable"
                                    Grid.Row="0" 
                                    Grid.Column="0"
                                    SelectionMode="Multiple"
                                    AutoGenerateColumns="False"
                                    CanUserDeleteRows="False"
                                    ItemsSource="{Binding AvailableGroups, ElementName=groupWindowBase, Mode=TwoWay}"
                                    ShowGroupPanel="False"
                                    RowIndicatorVisibility="Collapsed"
                                    IsFilteringAllowed="True" Margin="0,35,0,0">
            <gridViewElements:RadGridView.Columns>
                <gridViewElements:GridViewDataColumn x:Name="IdUserAvailable"
                                        Header="Nom"
                                        IsReadOnly="True" IsVisible="False"
                                        DataMemberBinding="{Binding Identifier}">
                </gridViewElements:GridViewDataColumn>

                <gridViewElements:GridViewDataColumn x:Name="IsUserAvailable"
                                        Header=""
                                        IsReadOnly="True"
                                        MinWidth="40"
                                        MaxWidth="40"
                                        IsVisible="False"
                                        DataMemberBinding="{Binding MyDocEtat}">
                    <gridViewElements:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding IsUser, Converter={StaticResource FieldToImageConverter}}"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center"
                                Width="20"
                                Height="20" />
                        </DataTemplate>
                    </gridViewElements:GridViewDataColumn.CellTemplate>
                </gridViewElements:GridViewDataColumn>

                <gridViewElements:GridViewDataColumn x:Name="GroupNameAvailable"
                                        Header="Nom"
                                        IsReadOnly="True"
                                        DataMemberBinding="{Binding Name}" />
            </gridViewElements:RadGridView.Columns>

        </gridViewElements:RadGridView>


        <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Margin="0" HorizontalAlignment="Right" Width="30">
            <Button x:Name="GoToRigthButton" Click="GoToRigthButton_Click" Margin="0,0,0,10" Width="25">
                <Image Width="16" Height="16" Margin="0,0,2,0" Source="/Rio.Framework.Pages;component/Assets/Images/arrow_right.png"/>
            </Button>
            <Button x:Name="GoToLeftButton" Click="GoToLeftButton_Click" Width="25" >
                <Image Width="16" Height="16" Margin="0,0,2,0" Source="/Rio.Framework.Pages;component/Assets/Images/arrow_left.png"/>
            </Button>
        </StackPanel>

        <TextBlock Name="UsersSelectedTextBlock" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="11" MaxWidth="330" TextWrapping="Wrap" Text="Groupes / Utilisateurs sélectionnés" Margin="0" Visibility="Collapsed" />
            <gridViewElements:RadGridView x:Name="GridUsersSelected"
                                      Grid.Row="0" 
                                      Grid.Column="2"
                                      SelectionMode="Single"
                                      AutoGenerateColumns="False"
                                      CanUserDeleteRows="False"
                                      ItemsSource="{Binding AddedGroups, ElementName=groupWindowBase, Mode=TwoWay}"
                                      ShowGroupPanel="False"
                                      RowIndicatorVisibility="Collapsed"
                                      IsFilteringAllowed="True" Margin="0,35,0,0">
            <gridViewElements:RadGridView.Columns>
                <gridViewElements:GridViewDataColumn x:Name="Id"
                                         Header="Nom"
                                         IsReadOnly="True" IsVisible="False"
                                         DataMemberBinding="{Binding Identifier}">
                </gridViewElements:GridViewDataColumn>
                
                <gridViewElements:GridViewDataColumn x:Name="IsUser"
                                         Header=""
                                         IsReadOnly="True"
                                         MinWidth="40"
                                         MaxWidth="40"
                                         IsVisible="False"
                                         DataMemberBinding="{Binding MyDocEtat}">
                    <gridViewElements:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding IsUser, Converter={StaticResource FieldToImageConverter}}"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Width="20"
                                   Height="20" />
                        </DataTemplate>
                    </gridViewElements:GridViewDataColumn.CellTemplate>
                </gridViewElements:GridViewDataColumn>
                
                <gridViewElements:GridViewDataColumn x:Name="GroupName"
                                         Header="Nom"
                                         IsReadOnly="True"
                                         DataMemberBinding="{Binding Name}" />
                </gridViewElements:RadGridView.Columns>
            
        </gridViewElements:RadGridView>

        
        <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="3" Margin="0,30,4,0" HorizontalAlignment="Center" VerticalAlignment="Top" >
            <Button x:Name="UpButton" Click="UpButton_Click"  Margin="3,5,2,10" Width="25" VerticalAlignment="Top">
                <Image Width="16" Height="16" Margin="0,0,2,0" Source="/Rio.Framework.Pages;component/Assets/Images/arrow_up.png"/>
            </Button>
            <Button x:Name="DownButton" Click="DownButton_Click" Margin="3,0,2,10" Width="25" VerticalAlignment="Top">
                <Image Width="16" Height="16" Margin="0,0,2,0" Source="/Rio.Framework.Pages;component/Assets/Images/arrow_down.png"/>
            </Button>

        </StackPanel>

        <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2" Margin="0,0,0,10" d:LayoutOverrides="GridBox" VerticalAlignment="Bottom" HorizontalAlignment="Right">
            <Button Name="OkButton" Margin="0,0,10,0" Click="OkButton_Click" Height="30" Width="100" />
            <Button Width="100" Name="CancelButton" Click="CancelButton_Click" Height="30" />
        </StackPanel>

    </Grid>
</local:GroupWindowBase>
